package com.dashboard.elasticsearch;

import com.dashboard.common.utils.R;
import com.dashboard.vo.QueryVO;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;

import java.io.IOException;

/**
 * @author xuxiao
 */
public interface ElasticsearchOperatorService {

    /**
     * 做查询
     * @param queryVO 查询条件
     * @return 返回结果
     */
    R doSearch(QueryVO queryVO) ;

    /**
     * 构建的es 查询请求实体
     * @param queryVO 查询条件
     * @return 返回SearchRequest
     */
    SearchRequest buildSearchRequest(QueryVO queryVO);

    /**
     * 对查询结果集解析并返回给前端
     * @param searchResponse es 返回结果
     * @return 返回 r
     */
    R parseElasticsearchResult(SearchResponse searchResponse);

}
